#!/bin/sh
# Save time creating new shell scripts.
usage() { printf >&2 'usage: %s FILENAME\n' "${0##*/}"; exit; }
err() { printf >&2 '%s: error: %s\n' "${0##*/}" "$*"; exit 2; }
main() {
  case $# in
    0) usage ;;
    1) ;;
    *) err "only 1 argument is allowed!" ;;
  esac
  if test -e "$1"; then
    err "$1 already exists!"
  else
    echo "#!/bin/sh" > "$1" && chmod 744 "$1"
    "${EDITOR:-nano}" "$1"
  fi
}
main "$@"
